package com.interagriculture.controller;

import com.interagriculture.common.PageResult;
import com.interagriculture.common.Result;
import com.interagriculture.entity.UserInfo;
import com.interagriculture.entity.query.UserInfoQuery;
import com.interagriculture.service.UserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (UserInfo)表控制层
 *
 * @author makejava
 * @since 2024-10-23 17:20:18
 */
@RestController
@RequestMapping("/userInfo")
@Slf4j
public class UserInfoController {
    @Resource
    private UserInfoService userInfoService;

    /**
     * 获取所有成员信息
     * @param userInfoQuery
     * @return
     */
    @GetMapping("/getInfo")
    public Result<PageResult> getInfo(@RequestBody(required = false) UserInfoQuery userInfoQuery){
        PageResult pageResult = userInfoService.selectByPage(userInfoQuery);
        return Result.ok(pageResult);
    }
    @GetMapping("/getById")
    public Result<UserInfo> getById(@RequestParam Integer id){
        UserInfo userInfo = userInfoService.selectById(id);
        return Result.ok(userInfo);
    }

}

